knitr::opts_chunk$set(echo = TRUE)
#I load my packages as I use them so you can see what 
#they are used with.
library(dplyr)
library(ggplot2)
library(tidycensus)
library(viridis)
library(plotly)
library(readxl)
library(ggplot2)
library(dplyr)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✔ tibble  3.1.7     ✔ purrr   0.3.4
## ✔ tidyr   1.2.0     ✔ stringr 1.4.0
## ✔ readr   2.1.2     ✔ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ plotly::filter() masks dplyr::filter(), stats::filter()
## ✖ dplyr::lag()     masks stats::lag()
stusurvey <- read_excel("C:/Users/abdul/Downloads/DSPG/school_surveys.xlsx",sheet = "Students")

subset_stusurvey <- stusurvey[1:6,c(1,4)]
decision <- subset_stusurvey$Schools
nums <- subset_stusurvey$`Q3: I help my class make decisions at school`
nums <- nums*100
nums2 <- as.numeric(nums)
ggplot(subset_stusurvey, aes(x =decision, y = nums2, fill = decision)) + geom_bar(position = "stack", stat="identity", width = 0.5) + labs(x = "School", y= "Percentage", caption = "", titlel = "I help my class make decisions at school") + guides(fill = guide_legend(title = ""))+ theme(axis.text.x = element_text(angle=0))+geom_text(aes(label = nums2, y = nums2), size = 3, position = position_stack(vjust = 1.02))

Forest Grove has the highest percentage of 77%. Makes the students feel involved.Guilford comes in last place with 59%.

subset_stusurvey <- stusurvey[1:6,c(1,5)]
different <- subset_stusurvey$Schools
nums5 <- subset_stusurvey$`Q5: Students treat students who are different from them with respect.`
nums5 <- nums5*100
nums2 <- as.numeric(nums5)
h <- ggplot(subset_stusurvey, aes(x =different, y = nums2, fill = different)) + geom_bar(position = "stack", stat="identity") + labs(x = "School", y= "Percentage", caption = "", titlel = "Students treat students who are different from them with respect") + guides(fill = guide_legend(title = ""))+ theme(axis.text.x = element_text(angle=0))+geom_text(aes(label = nums2, y = nums2), size = 3, position = position_stack(vjust = 1.01))

 ggplotly(h)

Sully being at first place with 88% shows students are comfortable and adapt well with students of differen traces and ethnic backgrounds. Sterling has the lowest percentage of 68%.

subset_stusurvey <- stusurvey[1:6,c(1,6)]
different <- subset_stusurvey$Schools
nums5 <- subset_stusurvey$`Q7: There are teachers or other adults at this school I could talk with if I needed help with something.`
nums5 <- nums5*100
nums2 <- as.numeric(nums5)
h <- ggplot(subset_stusurvey, aes(x =different, y = nums2, fill = different)) + geom_bar(position = "stack", stat="identity") + labs(x = "School", y= "Percentage", caption = "", titlel = "There are teachers or adults at this school I could talk with if I needed help") + guides(fill = guide_legend(title = ""))+ theme(axis.text.x = element_text(angle=0))+geom_text(aes(label = nums2, y = nums2), size = 3, position = position_stack(vjust = 1.01))

 ggplotly(h)

All schools have a percentage above 90% which tells us the learning environment in the school is very comfortable and friendly.

subset_stusurvey <- stusurvey[1:6,c(1,7)]
different <- subset_stusurvey$Schools
nums5 <- subset_stusurvey$`Q8: Teachers and other adults at this school expect me to do well in school.`
nums5 <- nums5*100
nums2 <- as.numeric(nums5)
h <- ggplot(subset_stusurvey, aes(x =different, y = nums2, fill = different)) + geom_bar(position = "stack", stat="identity") + labs(x = "Schools", y= "Percentage", caption = "", titlel = "Teachers and adults at this school expect me to do well in school") + guides(fill = guide_legend(title = ""))+ theme(axis.text.x = element_text(angle=0))+geom_text(aes(label = nums2, y = nums2), size = 3, position = position_stack(vjust = 1.01))

 ggplotly(h)

All schools have a percentages higher than 90% which shows teachers have higher expectations from students and want them to excel.

subset_stusurvey <- stusurvey[1:6,c(1,8)]
different <- subset_stusurvey$Schools
nums5 <- subset_stusurvey$`Q13: I can explain an idea to other people and have them understand what I am saying.`
nums5 <- nums5*100
nums2 <- as.numeric(nums5)
h <- ggplot(subset_stusurvey, aes(x =different, y = nums2, fill = different)) + geom_bar(position = "stack", stat="identity") + labs(x = "Schools", y= "Percentage", caption = "", titlel = "I can explain an idea to other people and have them understand") + guides(fill = guide_legend(title = ""))+ theme(axis.text.x = element_text(angle=0))+geom_text(aes(label = nums2, y = nums2), size = 3, position = position_stack(vjust = 1.01))

 ggplotly(h)

Shows understanding of students and teachers. Shows that students feel comfortable at school sharing their ideas and problems.

subset_stusurvey <- stusurvey[1:6,c(1,9)]
different <- subset_stusurvey$Schools
nums5 <- subset_stusurvey$`Q18: I get a chance to look back at my work in school and fix it or make it better`
nums5 <- nums5*100
nums2 <- as.numeric(nums5)
h <- ggplot(subset_stusurvey, aes(x =different, y = nums2, fill = different)) + geom_bar(position = "stack", stat="identity") + labs(x = "Schools", y= "Percentage", caption = "", titlel = "I get a chance to look back at my work in school and fix it or make it better") + guides(fill = guide_legend(title = ""))+ theme(axis.text.x = element_text(angle=0))+geom_text(aes(label = nums2, y = nums2), size = 3, position = position_stack(vjust = 1.01))

 ggplotly(h)

Shows how much students are motivated and want there work to be perfect. Shows how much students are encouraged and set high standards.